/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.tabbedproperties.section;

import org.eclipse.jface.viewers.IFilter;
import org.eclipse.uml2.uml.Element;

import com.cea.papyrus.core.editpart.IUMLElementEditPart;

/**
 * 
 */
public class UMLElementFilter implements IFilter {

	/**
	 * 
	 */
	protected Element element = null;
	
    /**
     * 
     * 
     * @param object 
     * 
     * @return 
     */
    public boolean select(Object object) {
    	// Not a uml element
    	if (!(object instanceof IUMLElementEditPart)) {
    		return false;
    	}
    	if (((IUMLElementEditPart) object).isElementImport()){
    		element = ((IUMLElementEditPart) object).getElementImport();
    	}
    	else{
    		element = ((IUMLElementEditPart) object).getUmlElement();
    	}
    	// return true only if the property type is not an enumeration
        if (element != null) {
        		return true;
        }
        
        return false;
    }
}